RatioInterval<T>

Represents a ratio value that occurs at regular time intervals, enabling conversion between different time periods. This class combines a base time interval (from the class) with a ratio value to calculate total ratio amounts across different time periods.

Syntax

public class RatioInterval<T> : Interval<T> where T : IComparable<T>, IConvertible

Inheritance

Constructors

RatioInterval

public RatioInterval()
Initializes a new instance of the class with default values.

RatioInterval

public RatioInterval(decimal ratio, T value, IntervalType type)
Initializes a new instance of the class with the specified ratio, interval value, and type.

Parameters

  • ratio decimal: The decimal ratio value that is calculated over the given interval.
  • value T: The duration of the interval.
  • type IntervalType: The base unit that describes what the quantity of this interval references.

RatioInterval

public RatioInterval(T value, IntervalType type)
Initializes a new instance of the class with the specified interval value and type.

Parameters

  • value T: The duration of the interval.
  • type IntervalType: The base unit that describes what the quantity of this interval references.

Properties

Ratio

public decimal Ratio { get; set; }
Gets or sets the decimal ratio value that is calculated over the given interval. Can represent a ratio, rate, or other decimal value per time period.

Returns

decimal

Methods

RatioPerDay

public decimal RatioPerDay()
Calculates the total ratio value per day based on the interval and ratio. This method multiplies the interval frequency (how many intervals occur per day) by the ratio value.

Returns

decimal The total ratio value per day as a decimal.

RatioPerDay

public decimal RatioPerDay(decimal quantity)
Calculates the total ratio value per day for a given quantity based on the interval and ratio.

Parameters

  • quantity decimal: The quantity to apply the ratio calculation to.

Returns

decimal The total ratio value per day as a decimal.

RatioPerHour

public decimal RatioPerHour()
Calculates the total ratio value per hour based on the interval and ratio. This method multiplies the interval frequency (how many intervals occur per hour) by the ratio value.

Returns

decimal The total ratio value per hour as a decimal.

RatioPerHour

public decimal RatioPerHour(decimal quantity)
Calculates the total ratio value per hour for a given quantity based on the interval and ratio.

Parameters

  • quantity decimal: The quantity to apply the ratio calculation to.

Returns

decimal The total ratio value per hour as a decimal.

RatioPerMinute

public decimal RatioPerMinute()
Calculates the total ratio value per minute based on the interval and ratio. This method multiplies the interval frequency (how many intervals occur per minute) by the ratio value.

Returns

decimal The total ratio value per minute as a decimal.

RatioPerMinute

public decimal RatioPerMinute(decimal quantity)
Calculates the total ratio value per minute for a given quantity based on the interval and ratio.

Parameters

  • quantity decimal: The quantity to apply the ratio calculation to.

Returns

decimal The total ratio value per minute as a decimal.

RatioPerMonth

public decimal RatioPerMonth()
Calculates the total ratio value per month based on the interval and ratio. This method multiplies the interval frequency (how many intervals occur per month) by the ratio value.

Returns

decimal The total ratio value per month as a decimal.

RatioPerMonth

public decimal RatioPerMonth(decimal quantity)
Calculates the total ratio value per month for a given quantity based on the interval and ratio.

Parameters

  • quantity decimal: The quantity to apply the ratio calculation to.

Returns

decimal The total ratio value per month as a decimal.

RatioPerWeek

public decimal RatioPerWeek()
Calculates the total ratio value per week based on the interval and ratio. This method multiplies the interval frequency (how many intervals occur per week) by the ratio value.

Returns

decimal The total ratio value per week as a decimal.

RatioPerWeek

public decimal RatioPerWeek(decimal quantity)
Calculates the total ratio value per week for a given quantity based on the interval and ratio.

Parameters

  • quantity decimal: The quantity to apply the ratio calculation to.

Returns

decimal The total ratio value per week as a decimal.

RatioPerYear

public decimal RatioPerYear()
Calculates the total ratio value per year based on the interval and ratio. This method multiplies the interval frequency (how many intervals occur per year) by the ratio value.

Returns

decimal The total ratio value per year as a decimal.

RatioPerYear

public decimal RatioPerYear(decimal quantity)
Calculates the total ratio value per year for a given quantity based on the interval and ratio.

Parameters

  • quantity decimal: The quantity to apply the ratio calculation to.

Returns

decimal The total ratio value per year as a decimal.

Remarks

  • Value: Always represents a time duration (e.g., 1.5 hours, 2 days)
  • Type: The time unit for the Value (Hours, Days, Months, etc.)
  • Ratio: The decimal ratio that occurs each interval period

  • Per* methods (inherited): Calculate how many intervals fit in a time period
  • RatioPer* methods: Calculate total ratio value for a time period (intervals × ratio)

  • Conversion rates: “Convert 70% of leads every 2 weeks”
  • Performance metrics: “Achieve 0.95 efficiency ratio every 8 hours”
  • Quality metrics: “Maintain 0.99 success ratio every day”